package com.company.planner.entity;

import com.haulmont.cuba.core.entity.StandardEntity;

import javax.persistence.*;

@Table(name = "PLANNER_IK_ANALYSIS_RULE")
@Entity(name = "planner_IkAnalysisRule")
public class IkAnalysisRule extends StandardEntity {
    private static final long serialVersionUID = -987457558299201661L;

    @JoinColumn(name = "INDEXS_ID")
    @ManyToOne(fetch = FetchType.LAZY)
    private Indexs indexs;

    @Column(name = "RULE_EXPRESSION")
    private String ruleExpression;

    @Column(name = "INDEX_NAME")
    private String indexName;

    @Column(name = "MAPPING_NAME")
    private String mappingName;

    @Column(name = "ACTIVE")
    private Integer active;

    public String getMappingName() {
        return mappingName;
    }

    public void setMappingName(String mappingName) {
        this.mappingName = mappingName;
    }

    public String getIndexName() {
        return indexName;
    }

    public void setIndexName(String indexName) {
        this.indexName = indexName;
    }

    public Indexs getIndexs() {
        return indexs;
    }

    public void setIndexs(Indexs indexs) {
        this.indexs = indexs;
    }

    public void setActive(ActiveEnum active) {
        this.active = active == null ? null : active.getId();
    }

    public ActiveEnum getActive() {
        return active == null ? null : ActiveEnum.fromId(active);
    }

    public String getRuleExpression() {
        return ruleExpression;
    }

    public void setRuleExpression(String ruleExpression) {
        this.ruleExpression = ruleExpression;
    }
}